import axios from 'axios'

// axios.defaults.baseURL = 'http://127.0.0.1:7001/api'

// Add a request interceptor
axios.interceptors.request.use(function (config) {
    //将本地的token信息 挂载到 axios的请求头上
    config.headers.authorization = sessionStorage.getItem('token') || ''
    // Do something before request is sent
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });

// Add a response interceptor
axios.interceptors.response.use(function (response) {
    // Do something with response data
    return response;
  }, function (error) {
    // Do something with response error
    return Promise.reject(error);
  });

  export default axios


  